﻿using System;
using Conference.Domain.ValueObject;

namespace Conference.Domain.Entity
{
   public class Customer : AggregationRoot<Guid>
    {
        /// <summary>
        /// 客户姓名
        /// </summary>
        public string CustomerName { get; set; }
        /// <summary>
        /// 客户年龄
        /// </summary>
        public string CustomerAge { get; set; }
        /// <summary>
        /// 客户电话
        /// </summary>
        public string CustomerPhone { get; set; }
        /// <summary>
        /// 客户地址
        /// </summary>
        public Address CustomerAddress { get; set; }
       
        public Customer(Guid id) : base(id)
        {

        }

        public Customer()
        {

        }


        /// <summary>
        /// 验证实体，以及创建客户
        /// </summary>
        /// <param name="customerName">客户名称</param>
        /// <param name="customerAge">客户年龄</param>
        /// <param name="customerPhone">客户电话</param>
        /// <param name="province">省</param>
        /// <param name="city">市</param>
        /// <param name="county">区</param>
        /// <param name="addressDetails">详细地址</param>
        /// <returns></returns>
        public Customer CreateCustomer(string customerName, string customerAge, string customerPhone, string province, string city, string county, string addressDetails)
        {
            if (string.IsNullOrEmpty(customerName))
            {
                throw new ArgumentException("客户名称为空！");
            }
            this.CustomerAddress = new Address(province, city, county, addressDetails);
            this.CustomerAge = customerAge;
            this.CustomerName = customerName;
            this.CustomerPhone = customerPhone;
            return this;
        }
       

    }
}
